package basic.courseLearn07;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.Objects;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Node {
    public int value; //节点值
    public int in; //入度
    public int out; //出度
    public ArrayList<Node> nexts; //下一个节点


    @Override
    public int hashCode() {
        return Objects.hash(value);
    }

    @Override
    public String toString() {
        return "Node{" +
                "value=" + value +
                '}';
    }

    public ArrayList<Edge> edges; //边


    public Node(int value) {
        this.value = value;
        this.in = 0;
        this.out = 0;
        this.nexts = new ArrayList<Node>();
        this.edges = new ArrayList<Edge>();
    }

    public void addNext(Node node) {
        // 添加节点到nexts中
        this.nexts.add(node);
    }

}
